package csu.jpetstore.jpetstore.service;

import csu.jpetstore.jpetstore.domain.AdminPermission;
import csu.jpetstore.jpetstore.domain.AdminRole;
import csu.jpetstore.jpetstore.repository.AdminRoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class AdminRoleService {
    @Autowired
    AdminRoleRepository adminRoleRepository;

    public AdminRole getRoleById(int id){
        return adminRoleRepository.findById(id);
    }
    public List<String> getRoles(List<Integer> ids){
        List<String> roles = new ArrayList<>();
        for (Integer id : ids) {
            roles.add(getRoleById(id).getRoleName());
        }
        return roles;
    }
}
